package com.hmall.user.web;


import com.hmall.user.pojo.Address;
import com.hmall.user.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/address")
public class AddressController {

    @Autowired
    AddressService addressService;

    @GetMapping("/uid")
    public List<Address> getAddressByUserId(){
        return addressService.getAddressByUserId();
    }

    @GetMapping("/{addressId}")
    public Address getAddressById(@PathVariable Long addressId){
        return addressService.getAddressById(addressId);
    }

}
